﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace IFTRUE.FMS.Web.Aspx
{
    public partial class LogManage :PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Hashtable ht = SearchCondition();
            string strPageNum = Request.Form["pageNum"] == null ? divPagination.Attributes["currentPage"] : Request.Form["pageNum"];
            string s = new BLL.Log().GetDataByPage(Convert.ToInt32(strPageNum), Convert.ToInt32(this.divPagination.Attributes["numPerPage"]), ht);
            literal2.Text = s.Split('★')[0];
            literal1.Text = s.Split('★')[1];
            divPagination.Attributes["totalCount"] = literal2.Text;
            divPagination.Attributes["currentPage"] = strPageNum;

            LogType.Value = Request.Form["LogType"];
            txtBeginDate.Value = Request.Form["txtBeginDate"];
            txtEndDate.Value = Request.Form["txtEndDate"];
        }

        // <summary>
        /// 查询条件
        /// </summary>
        /// <returns></returns>
        public Hashtable SearchCondition()
        {
            Hashtable ht = new Hashtable();

            //消息主体
            if (!string.IsNullOrEmpty(Request.Form["LogType"]))
            {
                ht.Add("Type", Request.Form["LogType"]);
            }
            if (!string.IsNullOrEmpty(Request.Form["txtBeginDate"]))
            {
                ht.Add("CreateDate", Request.Form["txtBeginDate"]);
            }
            if (!string.IsNullOrEmpty(Request.Form["txtEndDate"]))
            {
                ht.Add("CreateDateEnd", Request.Form["txtEndDate"]);
            }
            return ht;
        }
    }
}